package leetcode_top;
import org.junit.*;
public class Ex172 {
    class Solution {
        public int trailingZeroes(int n) {
            long res = 0L, t = 5L;

            while (true) { 
                if (n >= t) {
                    res += n / t;
                    t *= 5;
                } else {
                    return res > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)res;
                }
            }
        }
    }

    @Test
    public void test() {
        Solution s = new Solution();
        System.out.println(s.trailingZeroes(30));
    }

    /* 
        select e.first_name 
        from employees as e
        inner join (
            select t.first_name, 
                ROW_NUMBER()
                OVER(order by t.first_name)
                as r_num
            from employees
        ) as t
        on e.first_name = t.first_name
        and t.r_num % 2 = 1;

    */


    /* 
        1. select sum() over(partition by uid) as sumUser, count(*) from user;
        2. select *, sum() over(partition by uid) summer from user;
        3. select sum() over() where score > 80;
    
    */
}
